<ui:composition template="/templates/main.xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<ui:define name="body">
		<link rel="stylesheet" href="css/themes/redmond/jquery.ui.all.css" />
		<script src="js/ui/jquery.ui.position.js"></script>
		<script src="js/ui/jquery.ui.resizable.js"></script> 
		<script src="js/ui/jquery.ui.core.js"></script>
		<script src="js/ui/jquery.ui.widget.js"></script>
		<script src="js/ui/jquery.ui.dialog.js"></script>
		<script type="javascript">
		
		$(document).ready(function(){
    			/*$("#existItem").bind("change",function(){
						$("#panel\\:form\\:smallType").removeAttr("disabled");
						$("#panel\\:form\\:bigType").removeAttr("disabled");
						$("#panel\\:form\\:bigType1").attr("disabled",true);
						$("#panel\\:form\\:smallType1").attr("disabled",true);
						$("#panel\\:form\\:bigType1").val("");
						$("#panel\\:form\\:smallType1").val("");
					});
				$("#existItem1").bind("change",function(){
						$("#panel\\:form\\:smallType1").removeAttr("readonly");
						$("#panel\\:form\\:bigType1").removeAttr("readonly");
						$("#panel\\:form\\:bigType").attr("disabled",true);
						$("#panel\\:form\\:smallType").attr("disabled",true);
						$("#panel\\:form\\:smallType").val("");
					});*/

					$("#panel\\:form\\:add").click(function(){
							if($("#panel\\:form\\:smallType").val()==""){
							alert("小分类不能为空！");
							return false;
							}		
						});
					$("#panel\\:form\\:newAdd").click(function(){
							if($("#panel\\:form\\:bigType1").val()==""){
							alert("小分类不能为空！");
							return false;
							}
					if($("#panel\\:form\\:smallType1").val()==""){
							alert("大分类不能为空！");
							return false;
							}				

						});
  			});

		</script>
	
		<rich:panel>
			<f:facet name="header">
				<h:outputText value="添加类别"></h:outputText>
			</f:facet>
			
			<h:form id="form">
				<table width="750" height="356" border="0" align="center" cellpadding="0" cellspacing="4">
					<c:if test="#{classify.size != 0}">
					<tr>
						<td colspan="4" align="left">
							在现有项中添加
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<hr size="1" color="#E0E0E0" />
						</td>
					</tr>
					<tr>
						<td colspan="4" align="left">
							大分类：<h:selectOneMenu id="bigType" value="#{classify.bigClassify}">
										<f:selectItems value="#{classify.bigClassifyItem}" />
									</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="left">
							小分类：<h:inputText id="smallType" value="#{classify.smallClassify}" />
						</td>
					</tr>
					<tr>
						<td align="center" colspan="4">	
							<h:commandButton id="add" action="#{classify.insertClassify}" value="添  加"></h:commandButton>
						</td>
					</tr>
					</c:if>
					<tr>
						<td colspan="4" align="left">
							在新建项中添加			
						</td>
						 
					</tr>
					<tr>
						<td colspan="4">
							<hr size="1" color="#E0E0E0" />
						</td>
					</tr>
					
					<tr>
						<td colspan="4" align="left">
							大分类：<h:inputText id="bigType1" value="#{classify.newBigClassify}" />
						</td>
					</tr>
					<tr>
						<td colspan="4" align="left">
							小分类：<h:inputText id="smallType1" value="#{classify.newSmallClassify}"/>
						</td>
					</tr>
					<tr>
						<td align="left" colspan="4">	
							<h:commandButton id="newAdd" action="#{classify.insertNewClassify}" value="添   加"></h:commandButton>
						</td>
					</tr> 
								
				</table>
			</h:form>
		</rich:panel>
		
  	</ui:define>
</ui:composition>
